home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2008 April
/
PCWorld_2008-04_cd.bin
/
komercni software
/
miton
/
SystemMechanic7Pro.exe
/
{app}
/
smhtml.dll
/
1033
/
HTML
/
PROGRESSBAR.JS
< prev
next >
Wrap
Text File
|
2008-01-24
|
6KB
|
190 lines
function ProgressBar()
{
this.ID = "";
this.Label = "";
this.Width = "200";
this.Height = "20";
this.GraphLabel = "98% free";
this.Show = __ShowProgressBar;
this.Hide = __HideProgressBar;
this.Render = __RenderProgressBar;
this.IsRendered = __IsRenderedProgressBar;
this.SetLabel = __SetProgressBarLabel;
this.SetProgress = __SetProgressBarProgress;
this.SetProgressGraphLabel = __SetProgressGraphLabel;
this._ShowProgressOnLeft = __ShowProgressOnLeft;
this.Progress = 0;
this._Visible = true;
this._Progress = 0;
this.ClientID = __GetProgressBarClientID;
}
function __IsRenderedProgressBar()
{
return Get( "progress_hidWidth_" + this.ID ) == null ? false : true;
}
function __RenderProgressBar()
{
if (this._Rendered) return "";
var content = "";
var display = "block";
var full = "inline";
var zero = "inline";
var img = "ITS_progressbar_left.gif";
var textOnBlue ="none";
var textOnEmptyBar = "inline";
if ( this.Progress == 0 )
{
img = "ITS_progressbar_empty_sidebar.gif";
zero = "none";
}
if ( this.Progress == 100 )
full = "none";
if(this._ShowProgressOnLeft(this.Progress))
{
textOnBlue ="inline";
textOnEmptyBar = "none";
}
if (!this._Visible) display = "none";
content += "<div id=\"progress_" + this.ID + "\" style=\"display:" + display + "\">";
content += "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\" >";
content += "<tr>";
content += "<td ><div style=\"padding:0 0 3 0;\" id=\"progress_lbl_" + this.ID + "\">" + this.Label + "</div></td>";
content += "</tr>";
content += "<tr>";
content += "<td >";
content += "<input type=\"hidden\" id=\"progress_hidWidth_" + this.ID + "\" value='" + this.Width + "'></input> ";
// progress bar
content += "<table border=\"0\" width=\"" + this.Width + "\" cellspacing=0 cellpadding=0 background=\"ITS_progressbar_empty.gif\" >";
content += "<tr>";
content += "<td align=left style=\"width: 1px; \" >";
content += "<img align=\"absmiddle\" id=\"progress_img_left_" + this.ID + "\" src=\""+ img +"\">";
content += "</td>";
content += "<td valign=middle align=\"right\" id=\"progress_td_"+ this.ID +"\" style=\"display:"+ zero +"; \" width=\"" + this.Progress + "%\" background=\"ITS_progressbar.gif\" >";
content += "<span class=\"progress_sp_bar_s\" id=\"progress_sp_text_right_"+ this.ID +"\" style=\"display:" + textOnBlue + ";\">" + this.GraphLabel+ "</span>";
content += "</td>";
content += "<td style=\"vertical-align:middle;display:"+ zero +"; \" id=\"progress_td_middle_"+ this.ID +"\" ><img align=\"absmiddle\" src=\"ITS_progressbar_left.gif\" >";
content += "<span class=\"progress_sp_emptybar_s\" id=\"progress_sp_text_left_"+ this.ID +"\" style=\"display:" + textOnEmptyBar + ";padding:0px 0px 0px 5px;white-space:nowrap;\" >" + this.GraphLabel+ "</span>";
content += "</td>";
content += "<td align=right style=\"display:"+ full +"; \" id=\"progress_td_right_"+ this.ID +"\" >";
content += "<img align=\"absmiddle\" src=\"ITS_progressbar_empty_sidebar.gif\">";
content += "</td>";
content += "</tr>";
content += "</table>";
content += "</td>";
content += "</tr>";
content += "</table>";
content += "</div>";
return content;
}
function __ShowProgressOnLeft(progress)
{
return (progress >= 20);
}
function __SetProgressBarLabel(label)
{
var element = document.getElementById("progress_lbl_" + this.ID);
element.innerHTML = label;
}
function __SetProgressBarProgress(progress)
{
if(progress>100)
progress = 100;
if(progress<0)
progress = 0;
var element = Get("progress_td_" + this.ID);
element.style.width = progress + "%";
var hidWidth = Get("progress_hidWidth_" + this.ID);
var width = hidWidth.value;
var bln = this._ShowProgressOnLeft(progress);
SetDisplayWidget("progress_sp_text_right_" + this.ID, bln);
SetDisplayWidget("progress_sp_text_left_" + this.ID, !bln);
if( progress == 100 )
Get("progress_td_right_" + this.ID).style.display = "none";
else
Get("progress_td_right_" + this.ID).style.display = "inline";
if( progress == 0 )
{
Get("progress_img_left_" + this.ID).src = "ITS_progressbar_empty_sidebar.gif";
Get("progress_td_" + this.ID).style.display = "none";
Get("progress_td_middle_" + this.ID).style.display = "none";
}
else
{
Get("progress_img_left_" + this.ID).src = "ITS_progressbar_left.gif";
Get("progress_td_" + this.ID).style.display = "inline";
Get("progress_td_middle_" + this.ID).style.display = "inline";
}
}
function __SetProgressGraphLabel(Value)
{
if(!this.IsRendered()) return;
Get("progress_sp_text_right_"+ this.ID).innerHTML = Value;
Get("progress_sp_text_left_"+ this.ID).innerHTML = Value;
}
function __HideProgressBar()
{
var element = document.getElementById("progress_" + this.ID);
element.style.display = "none";
}
function __ShowProgressBar()
{
var element = document.getElementById("progress_" + this.ID);
element.style.display = "block";
}
function __GetProgressBarClientID()
{
return "progress_" + this.ID;
}
function pro1()
{
p = new ProgressBar();
p.ID = "s";
p.Width = "333";
p.Progress = 50;
Get('divHardDriveProgressBar').innerHTML = p.Render();
//alert('s');
}
var x = 0;
function pro2()
{
p = new ProgressBar();
p.ID = "s";
p.SetProgress(0);
x += 10;
}